package cn.kgc.feignclient;

import cn.kgc.fallback.UserFeignClientFallBack;
import cn.kgc.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @ClassName UserFeignClient
 * @Description TODO
 * @Author yaozhaobao
 * @Date 2020/12/13 11:02
 * @Version 1.0
 **/
@Component
@FeignClient(value = "user-provider",fallback = UserFeignClientFallBack.class)
public interface UserFeignClient {

    /**
     * 声明provider中的数据接口   多参数直接传参数
     * @param userCode
     * @param userPssword
     * @return
     */
    @RequestMapping(value="checkpwd",method = RequestMethod.GET)
    public boolean loginByNP(@RequestParam("userCode") String userCode, @RequestParam("pwd") String userPssword) throws Exception;


    /**
     * Map传递参数  对象入参，则请求方式必须是POST
     * @param map
     * @return
     */
    @RequestMapping(value="checkpwd2",method = RequestMethod.POST)
    public boolean loginByNP2(@RequestBody Map<String,String> map);





    // 自定义对象入参，则请求方式必须是POST
    @RequestMapping(value="checkpwd3",method = RequestMethod.POST)
    public boolean loginByNP3(@RequestBody User user);



    @PostMapping(value = "addUser")
    public Integer addUser(@RequestBody User user);



    @GetMapping(value = "/addUser")
    public void testRibbon(@RequestParam int num) ;
}
